import time

from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By

# 0. 指定驱动所在位置
service = Service("C:/Program Files/Google/Chrome/Application/chromedriver.exe")
# 1. 实例化驱动对象
driver = webdriver.Chrome(service=service)

# 2.打开网页
driver.get("file:///C:/Users/82073/Desktop/pagetest/%E6%B3%A8%E5%86%8CA.html")

# 3.操作
    # 1) 使用id定位，输入用户名：admin
element = driver.find_element(By.ID, "userA")
element.send_keys("admin")
    # 2) 使用id定位，输入密码：123456
driver.find_element(By.ID, "passwordA").send_keys("123456")

# 4. 3秒后关闭浏览器窗口
time.sleep(3)

# 5.关闭驱动对象
driver.quit()